#pragma once

#include "Level.h"
#include "UserInterface.h"

// Physic System
#include "Physic\PhysicSystem.h"

class GameEngine
{
private:
	bool running;

	/** engine */
	DX9Engine* pEngine;

	/** input */
	Input* pInput;
	bool mbdown[MAX_MOUSEBUT];
	bool kbdown[MAX_KEYS];

	/** game states */
	enum GameState {MENU, GAME, WIN, LOSE} state;
	bool gamestart;

	//// ADD GAME CODE HERE ////

	// test texture 
	Texture a;
	Level l;


	// onscreendislay for debug
#ifdef MYAPP_DEBUG_TRACE
	OSD osd;
#endif

	// User Interface
	UserInterface ui;
	// bool for in game menu display
	bool igmenOn;

public:
	GameEngine(void)
	{}
	~GameEngine(void) { release(); }

	void initialize(HWND hWnd);
	void update(float dT);
	void render(void);
	void renderText();
	void release(void);
	bool isRunning() {return running;}
	/** Set Game Sate from UI 
	 * Should only change for MENU and GAME
	 */
	void updateState()
	{
		// update game state based on UI state
		switch(ui.getState())
		{
		case 0: state = MENU; break;
		case 1: state = GAME; break;
		case 2: break;
		}
	}
};